package string;

/**
 * valueOf()
 * 把其他类型转为字符串
 */
public class ValueOfDemo {
    public static void main(String[] args) {
        int i = 123;
        String s1 = String.valueOf(i);
        System.out.println(s1);

        double dou = 123.123;
        String s2 = String.valueOf(dou);
        System.out.println(s2);

        //s1 = i+"";//任何内容与字符串连接结果是字符串但是性能不如valueOf()
        //System.out.println();
    }
}
